package com.ygqh.baby.mapper;

import com.ygqh.baby.ao.*;
import com.ygqh.baby.model.OrderNotPushModel;
import com.ygqh.baby.model.YgCommissionOrderModel;
import com.ygqh.baby.model.YgOrderInfoModel;
import com.ygqh.baby.model.YgOrderModel;
import com.ygqh.baby.model.wdt.qyb.PushOrderToWdtResult;
import com.ygqh.baby.po.YgLogistics;
import com.ygqh.baby.po.YgOrder;
import com.ygqh.baby.po.YgOrderExample;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;
import java.util.Map;

public interface YgOrderMapper {
    int countByExample(YgOrderExample example);

    int deleteByExample(YgOrderExample example);

    int deleteByPrimaryKey(Long id);

    int insert(YgOrder record);

    int insertSelective(YgOrder record);

    List<YgOrder> selectByExample(YgOrderExample example);

    YgOrder selectByPrimaryKey(Long id);

    int updateByExampleSelective(@Param("record") YgOrder record, @Param("example") YgOrderExample example);

    int updateByExample(@Param("record") YgOrder record, @Param("example") YgOrderExample example);

    int updateByPrimaryKeySelective(YgOrder record);

    int updateByPrimaryKey(YgOrder record);

    int countSuper(@Param("supplierId") Long supplierId, @Param("orderId") Long orderId, @Param("payType") PayType payType,
                   @Param("orderStatus") OrderStatus orderStatus, @Param("startDate") Date startDate, @Param("endDate") Date endDate, @Param("q") String q,
                   @Param("userName") String userName, @Param("telPhone") String telPhone, @Param("validOrder") String validOrder, @Param("appType") String appType,
                   @Param("sourceCode") String sourceCode, @Param("orderType") OrderType orderType, @Param("productName") String productName);

    List<YgOrder> selectSuper(@Param("queryInfo") QueryInfo queryInfo, @Param("supplierId") Long supplierId, @Param("orderId") Long orderId,
                              @Param("payType") PayType payType, @Param("orderStatus") OrderStatus orderStatus, @Param("startDate") Date startDate,
                              @Param("endDate") Date endDate, @Param("q") String q, @Param("userName") String userName, @Param("telPhone") String telPhone,
                              @Param("validOrder") String validOrder, @Param("appType") String appType, @Param("sourceCode") String sourceCode,
                              @Param("orderType") OrderType orderType, @Param("productName") String productName);

    List<YgOrderModel> selectOrderList(@Param("queryInfo") QueryInfo queryInfo, @Param("userId") Long userId,
                                       @Param("orderStatus") String orderStatus, @Param("platformNo") String platformNo);

    YgOrderInfoModel selectOrderInfo(@Param("orderId") Long orderId, @Param("userId") Long userId);

    List<Map<String, Object>> selectCountByOrderStatus(@Param("userId") Long userId, @Param("platformNo") String platformNo);

    YgCommissionOrderModel selectOrderForBalance(@Param("sourceCode") String sourceCode);

    int cancelOrderByTask(@Param("orderIds") List<Long> orderIds, @Param("cancelReason") String cancelReason);

    List<YgOrder> selectOrderIdForCancelTask(@Param("currentDate") Date currentDate);

    List<YgOrder> selectOrderForSendPayInvitation(@Param("limitTime") Integer limitTime);

    List<YgOrder> selectOrderForBalaceTask(@Param("limitTime") Integer limitTime);

    YgOrder selectOrderDetailByOrderId(@Param("orderId") Long orderId, @Param("status") DataStatus status);

    int orderStatusForSuccessTask(@Param("orderIds") List<Long> orderIds);

    List<Map<String, Object>> selectOrderExportReport(@Param("startDate") Date startDate, @Param("endDate") Date endDate, @Param("userName") String userName,
                                                      @Param("sourceCode") String sourceCode, @Param("q") String q, @Param("orderStatus") String orderStatus, @Param("telPhone") String telPhone,
                                                      @Param("validOrder") Boolean validOrder, @Param("productName") String productName);

    int updateStatus4SendByTask(@Param("orderList") List<YgOrder> orderList);

    Map<String, Long> orderIsComment(@Param("orderId") Long orderId);

    List<YgOrder> findOrderFor30Day(@Param("startDate") Date startDate, @Param("endDate") Date endDate);

    List<YgOrder> selectOrder4SuccessTask(@Param("date") Date date);

    List<YgOrder> findReturnOrderForBalaceTask(@Param("limitTime") Integer limitTime);

    List<YgOrder> selectIntervalOrder(@Param("date") Date date);

    int insertBatch(@Param("orderList") List<YgOrder> orderList);

    List<YgOrder> findCancelOrderForBalaceTask(@Param("limitTime") Integer day);

    YgOrder findFirstOrder(@Param("userId") Long userId, @Param("limitDate") Date limitDate);

    List<YgOrder> findFirstOrderList(@Param("startDate") Date startDate, @Param("endDate") Date endDate);

    List<YgOrder> findReturnOrderForPreIncomeToBalance(@Param("day") Integer day);

    List<Map<String, Object>> selectOrderLogistics(@Param("startDate") Date startDate, @Param("endDate") Date endDate, @Param("userName") String userName,
                                                   @Param("sourceCode") String sourceCode, @Param("q") String q, @Param("orderStatus") String orderStatus, @Param("telPhone") String telPhone,
                                                   @Param("validOrder") Boolean validOrder);

    List<OrderNotPushModel> selectOrderNotPush(Date limitDate);

    List<YgOrderModel> selectOrderListByHeXiao(@Param("queryInfo") QueryInfo queryInfo, @Param("orderStatus") OrderStatus orderStatus,
                                               @Param("userName") String userName);

    YgOrder selectLastOrder(@Param("orderType") OrderType orderType, @Param("paid") Boolean paid);

    List<Map<String, Object>> selectOrderByProductName(@Param("productName") String productName);

    List<String> selectNoSendOrderBySupplier(@Param("supplierId") Long supplierId);

    List<Map<String, Object>> selectOrderDetailBySupplier(@Param("orderId") Long q, @Param("startDate") Date startDate, @Param("endDate") Date endDate,
                                                          @Param("orderStatus") OrderStatus orderStatus, @Param("telPhone") String telPhone, @Param("supplierId") Long supplierId);

    List<YgOrder> selectOrderBySupplier(@Param("queryInfo") QueryInfo queryInfo, @Param("q") String q, @Param("orderStatus") OrderStatus orderStatus,
                                        @Param("startDate") Date startDate, @Param("endDate") Date endDate, @Param("supplierId") Long supplierId, @Param("telPhone") String telPhone);

    int countBySupplier(@Param("q") String q, @Param("orderStatus") OrderStatus orderStatus, @Param("startDate") Date startDate, @Param("endDate") Date endDate,
                        @Param("supplierId") Long supplierId, @Param("telPhone") String telPhone);

    YgOrderInfoModel selectOrderDetailBySupplierOrderId(@Param("orderId") Long orderId, @Param("supplierId") Long supplierId);

    List<Map<String, Object>> selectOpenIdByOrder(@Param("orderList") List<YgLogistics> orderList);

    List<String> selectReturnByOrder(@Param("supplierId") Long supplierId, @Param("orderList") List<Long> orderList);

    List<Long> findExitOrderIds(@Param("orderIds") List<Long> orderIds);

    List<YgOrder> findByPaidTimeHasDetail(@Param("startDate") Date startDate, @Param("endDate") Date endDate, @Param("sourceCode") String sourceCode,
                                          @Param("supplierId") Long supplierId, @Param("orderStatus") OrderStatus[] orderStatus);

    List<YgOrder> selectOrderDetailByOrderIdList(@Param("orderNos") List<Long> orderNos);

    List<Map<String, Object>> getTotalPriceWithMonth(@Param("userId") Long userId, @Param("startDate") Date startDate, @Param("endDate") Date endDate);

    int selectReturnByOrder(@Param("supplierId") Long supplierId, @Param("orderId") Long orderId, @Param("skuCode") String skuCode);

    List<YgOrder> findOrderDetailByReturn(@Param("startDate") Date startDate, @Param("endDate") Date endDate, @Param("returnCode") String returnCode,
                                          @Param("returnType") ReturnType returnType, @Param("returnStatus") ReturnStatus[] returnStatus);

    List<YgOrder> findAgentOrderByPaidTimeHasDetail(@Param("startDate") Date startDate, @Param("endDate") Date endDate, @Param("userId") Long userId,
                                                    @Param("orderStatus") OrderStatus[] orderStatus);

    List<YgOrder> findGroupMemberOrderByPaidTimeHasDetail(@Param("startDate") Date startDate, @Param("endDate") Date endDate,
                                                          @Param("groupTag") String groupTag, @Param("orderStatus") OrderStatus[] orderStatus);

    List<YgOrder> findRODByOrderId(@Param("orderIds") List<Long> orderIds, @Param("returnType") ReturnType returnType,
                                   @Param("returnStatus") ReturnStatus[] returnStatus);

    List<YgOrder> selectByCreateTimeHasDetail(@Param("startDate") Date startDate, @Param("endDate") Date endDate,
                                              @Param("filterSourceList") List<String> filterSourceList);

    List<YgOrder> selectBySendTimeHasDetail(@Param("startDate") Date startDate, @Param("endDate") Date endDate, @Param("supplierId") Long supplierId,
                                            @Param("orderType") String[] orderType);

    YgOrder selectFirstSendOrder(@Param("userId") Long userId, @Param("limitDate") Date limitDate, @Param("limitOrderId") Long limitOrderId);

    int updateOrderStatusByOrderId(@Param("orderStatus") OrderStatus orderStatus, @Param("orderId") Long orderId);

    List<YgOrder> selectByGroupBuyId(@Param("orderStatus") OrderStatus orderStatus, @Param("groupBuyIdList") List<Long> groupBuyIdList);

    List<Map<String, Object>> selectNoSendOrderList(@Param("queryInfo") QueryInfo queryInfo,
                                                    @Param("startDate") Date startDate, @Param("endDate") Date endDate);

    int countNoSendOrderList(@Param("startDate") Date startDate, @Param("endDate") Date endDate);

    List<Map<String, Object>> selectNoSendOrderDetail(@Param("queryInfo") QueryInfo queryInfo, @Param("supplierId") Long supplierId,
                                                      @Param("startDate") Date startDate, @Param("endDate") Date endDate);

    int countNoSendOrderDetail(@Param("supplierId") Long supplierId, @Param("startDate") Date startDate, @Param("endDate") Date endDate);

    int updateWdtCode(@Param("orderIds") Long[] orderIds);

    List<YgOrderInfoModel> selectOrderInfoByPayTime(@Param("startTime") Date startTime,
                                                    @Param("endTime") Date endTime,
                                                    @Param("platformNo") String platformNo);

    YgOrder selectOrderDetailByOrderIdForThird(@Param("orderId") Long orderId);

    int updateWdtCodeBatch(@Param("resultList") List<PushOrderToWdtResult> resultList);

    List<YgOrder> selectOrderDetailListBySupplier(@Param("supplierId") Long supplierId, @Param("orderStatus") OrderDetailStatus orderStatus);

    List<YgOrder> selectByPaidTime(@Param("startTime") Date startTime, @Param("endTime") Date endTime,
                                   @Param("platformNo") String platformNo);
}
